# -*- coding: utf-8 -*-
# @Time    : 2024/8/30 下午2:27
# @Author  : wb
# @Email   : wb@163.com
# @File    : client_page
# @Software: PyCharm

from time import sleep
from pages.wb_base_page import BasePage
from selenium.webdriver.common.by import By


class ClientPage(BasePage):
    url = '/crm'
    # 定位器
    '''获取新建客户元素'''
    new_client_locator = (By.CSS_SELECTOR, 'body > div.container > div.row > div:nth-child(1) > div > a')
    '''获取客户关怀按钮元素'''
    client_care_locator = (By.CSS_SELECTOR,'body > div.container > div.page-header > ul > li:nth-child(4) > a')
    '''获取客户池按钮元素'''
    client_pool_locator = (By.CSS_SELECTOR, 'body > div.container > div.page-header > ul > li:nth-child(2) > a')
    '''获取查看按钮元素'''
    check_locator = (By.CSS_SELECTOR, '#form1 > table > tbody > tr:nth-child(1) > td:nth-child(12) > a:nth-child(1)')
    '''获取编辑按钮元素'''
    modify_locator = (By.CSS_SELECTOR, '#form1 > table > tbody > tr:nth-child(1) > td:nth-child(12) > a:nth-child(2)')




    # 浏览器操作
    def click_new_client(self):
        '''点击新建客户'''
        self.driver.find_element(*self.new_client_locator).click()
    def click_client_care(self):
        '''点击客户关怀'''
        self.driver.find_element(*self.client_care_locator).click()
    def click_client_pool(self):
        '''点击客户池'''
        self.driver.find_element(*self.client_pool_locator).click()
    def click_check(self):
        '''点击查看'''
        self.driver.find_element(*self.check_locator).click()
    def click_modify(self):
        '''点击编辑'''
        self.driver.find_element(*self.modify_locator).click()
        sleep(2)
